
import JSEncrypt from 'jsencrypt'

// 密钥对生成 http://web.chacuo.net/netrsakeypair
const publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC02jqV5mfgmJ6+q8BcR7/Bp/PX\n" +
            "Gxv95+tcBFMaEidAY1ZRkMswnLW3rih6hwSs+m/qsJ8/GfZifvJ4mywr3REE7E7C\n" +
            "GK0+m2cUIB1xXzPNA58YIS7gp33sh5wHvojl5LSpajei7SVr7Q6bm5zC77x1uL8b\n" +
            "ahVbouUQgfrj6sMc1wIDAQAB";
  
export function encrypt(txt) {
  var encryptor = new JSEncrypt()  // 创建加密对象实例
  encryptor.setPublicKey(publicKey) //设置公钥
  return encryptor.encrypt(txt) // 对内容进行加密
}
